<?php include "lang.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
	include "import.php";
	include "../service/bannerService.php";
	include "../service/CategoryService.php";
	
	$result = findAll();
	$isHasImage = ConnectionManager::getInstance()->getNumRows() > 0;
?>
<title>Gia An</title>
<script type="text/javascript">
	function slide(event, container){
		event.preventDefault();
		if (container.is(":visible")) container.slideUp(1000);
		else container.slideDown(1000);
	}
	
	$(function($){
		var container = $("#map");
		$("#sliding-map-header").click(function(event){ slide(event, container); });
		$("#map").click(function(event){ slide(event, container); });
	});
	
	$(function(){
		$('#banner').bxSlider({
			pause: 2500,
			auto: true,
			displaySlideQty: 1,
			moveSlideQty: <?php echo $isHasImage ? 1 : 0; ?>,
			nextImage: '../images/layout/scroll-right.png',
			prevImage: '../images/layout/scroll-left.png'
  		});
	});	
</script>
</head>
<body>
<div id="introduction-wrapper">
	<div id="content">
    	<div id="flash-text">
            <object onclick="window.location.href='service.php';">
                <param name="movie" value="giaan4s.swf">
                <embed src="../flash/giaan4s.swf" width="170" height="70" wmode="transparent" style="margin-top: 27px;" >
                </embed>
            </object>
        </div>
        <div id="company">
        	công ty tnhh TM & DV nội thất Gia An
        </div>
    	<div id="small-menu">
        	<?php 		
				$categories = findFirstThreeCategories();
				while($row = ConnectionManager::getInstance()->fetch($categories)){
			?>
                    <div class="menu-item" onclick="window.location.href = 'category.php?catId=<?php echo $row["CAT_ID"];next($row); ?>';">
                        <div class="ribbon-piece"></div>
                        <div class="arrow"></div>
                        <div><?php echo $row["CAT_NAME_VN"]; ?></div>
                    </div>
            <?php
				}
            ?>
        </div>
        <div id="logo"></div>
        <div id="intro-address">
        	<span>địa chỉ: 927b kha vạn cân - p.linh tây - q.thủ đức, tp.hcm</span>
            <span>điện thoại: (08) 3896 8402 - (08) 3896 4314 - fax: (848) 3896 4314</span>
        </div>
        <div id="sliding-banner">
            <div id="banner">
            	<?php
					$imagePath = "../images/banner/";
					while($row = ConnectionManager::getInstance()->fetch($result)){
				?>
                		<div><img src="<?php echo $imagePath.$row["BANNER_PATH"];?>" width="357" height="374"/></div>
                <?php
					}
					if(!$isHasImage){
                ?>
                		<div><img src="<?php echo "../images/cat/noimg.jpg";?>" width="357" height="374"/></div>
                <?php
					}
                ?>
            </div>
        </div>
        <div id="door">
        	<object>
                <param name="movie" value="door.swf">
                <embed src="../flash/door.swf" width="351" height="383" wmode="transparent" style="margin-top: 145px; margin-left: 60px;">
                </embed>
            </object>
        </div>
        <!--<div id="shadow"></div>-->
        <div id="sliding-map">
            <div id="sliding-map-header"></div>
            <div id="map"></div>
    	</div>	
    </div>
</div>
<script>
$(document).ready(function() {
	//$( "#sliding-map-header" ).hover(function(){
		var container = $( "#sliding-map-header" );
		//$("#sliding-map-header").css('padding', '40px auto 0px auto');
		//$("#map").css('padding', '40px auto 0px auto');
		//for(var i = 1; i <= 3; i++){
			//container.slideUp( 500 );
			//container.slideDown( 500 );
			//container.stop();
		//}
	//})
});
	
</script>
<?php ConnectionManager::getInstance()->closeConnection(); ?>
</body>
</html>